import request from '@/utils/request.js'

export const getArticles = (params) => request({
  method: 'GET',
  url: '/v1_1/articles',
  params
})

export const getNewArticlesById = (articleId) => request({
  url: `/v1_0/articles/${articleId}`,
  method: 'get'
})

export const userFollowings = (data) => request({
  url: '/v1_0/user/followings',
  method: 'post',
  data
})

export const cancelUserFollowings = (target) => request({
  url: `/v1_0/user/followings/${target}`,
  method: 'DELETE'
})

export const collectArticle = (target) => request({
  url: '/v1_0/article/collections',
  method: 'POST',
  data: {
    target
  }
})

export const cancleCollectArticle = (target) => request({
  url: `/v1_0/article/collections/${target}`,
  method: 'DELETE'
})

export const likeArticle = (target) => request({
  url: '/v1_0/article/likings',
  method: 'POST',
  data: {
    target
  }
})

export const cancleLikeArticle = (target) => request({
  url: `/v1_0/article/likings/${target}`,
  method: 'DELETE'
})
